﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Palsta.Core.data;

namespace Palsta.Core.exp
{
    class ExpValueNode : ExpNode
    {
        #region Members

        private String value;
        private FieldType type = FieldType.String;

        #endregion

        #region Constructors

        public ExpValueNode(String value)
        {
            this.value = value;
        }

        #endregion

        #region Accessors

        public virtual String Value
        {
            get
            {
                return this.value;
            }
            set
            {
                this.value = value;
            }
        }

        #endregion

        #region Methods

        public ExpNodeType GetNodeType()
        {
            return ExpNodeType.Value;
        }


        public bool Test(DataDictionary data)
        {
            return true;
        }

        public Field GetValue(DataDictionary data)
        {
            StringField f = new StringField(this.value);
            return f;
        }

        public FieldType GetFieldType(DataDictionary data)
        {
            return FieldType.String;
        }

        public void SetValue(String v)
        {
            this.value = v;
        }

        public String GetValue()
        {
            return this.value;
        }

        public FieldType GetFieldType()
        {
            return this.type;
        }

        public void SetFieldType(FieldType t)
        {
            this.type = t;
        }

        #endregion

        #region Override Operators

        #endregion

        #region Static Methods

        #endregion
    }

}
